package com.yimingkeji.cors;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Describe:
 * @Auther: zhenlong.yang
 * @Date: 2018/11/26 19:00
 */
@SpringBootApplication
@RestController
public class CorsApp {

    public static void main(String[] args) {
        SpringApplication.run(CorsApp.class, args);
    }

    @GetMapping("/")
    public String home(){
        return "hello world";
    }

    @GetMapping("/api/cors/get")
    public String get(){
        return "cors test get method";
    }

    //@CrossOrigin(origins = "http://localhost:1234")
    @PostMapping("/api/cors/post")
    public String post(){
        return "cors test post method";
    }
}
